import os

def getall(path,treeshow):
    filelist=os.listdir(path)
    for filename in filelist:
        filepath=os.path.join(path,filename) #完整路径
        if os.path.isdir(filepath):
            treeshow+="   "
            print(treeshow,'文件夹',filename)
            getall(filepath,treeshow)
        else:
            
            print(treeshow,'文件',filename)
getall(r"E:\黑马19年Java","")
